/*
 * @lc app=leetcode.cn id=122 lang=javascript
 *
 * [122] 买卖股票的最佳时机 II
 */

// @lc code=start
/**
 * @param {number[]} prices
 * @return {number}
 */
var maxProfit = function(prices) {
    let profit=0,len=prices.length
    for(let i=0;i<len-1;i++){
        let tom=prices[i+1]
        let today=prices[i]
        if(tom>today){
            profit+=tom-today
        }
    }
    return profit
};
// @lc code=end

